<?php
/**
* 显示主题帖子的网页模板
* $Id: thread.php 153 2010-05-05 22:22:48Z bwanglei $
*/

include_once(BASE_PATH.TEMP_DIR.'/header.php');
include_once(BASE_PATH.TEMP_DIR.'/header_b.php');
?>
<div id="content_b">
	<?php foreach ($articles_thread as $article_thread) { ?>
	<a name="<?php echo $article_thread['article_id'];?>"></a>
	<!-- 显示一个帖子 -->
	<div class="article_thread">
		<div class="header_article_thread">发表时间：<?php echo date('H:i:s m-d Y年',$article_thread['time_date']);?></div>
		<div class="content_article_thread">
			<div class="sidebar_article_thread"><?php echo $article_thread['username'];?></div>
			<div class="main_article_thread">
				<div class="title_main_article_thread"><?php echo $article_thread['title'];?></div>
				<div class="content_main_article_thread"><?php echo $article_thread['content'];?></div>
			</div>
		</div>
	</div>
	<!-- 显示一个帖子 -->
	<?php }?>

	<!-- 页面导航 -->
	<div id="daohang_page">
		第<?php echo $num_page;?>页&nbsp;
		总<?php echo $count_page;?>页&nbsp;&nbsp;
		<?php if ($num_page == 1) {?>
		第一页
		<?php } else {?>
		<a href="<?php echo apf_first_last_uri('1');?>">第一页</a>
		<?php }?>
		<?php if ($num_page != 1) {?>
			<a href="<?php echo apf_daohang_page_uri('b',$num_page,'pre',$_GET);?>">上一页</a>
		<?php } else {?>
			上一页
		<?php }?>&nbsp;
		<select onchange="document.location.href=this.options[this.selectedIndex].value;">
			<?php
			for ($i=1;$i<=$count_page;$i++) {
				if ($num_page == $i) {
				?>
				<option value="<?php echo apf_first_last_uri($i);?>" selected><?php echo $i;?></option>
				<?php } else {?>
				<option value="<?php echo apf_first_last_uri($i);?>"><?php echo $i;?></option>
				<?php
				}
			}
			?>
		</select>
		<?php if ($num_page < $count_page) {?>
			<a href="<?php $next_page_uri = apf_daohang_page_uri('b',$num_page,'next',$_GET);echo $next_page_uri;?>">下一页</a>
		<?php } else {?>
			下一页
		<?php }?>&nbsp;
		<?php if ($num_page == $count_page) {?>
		最后一页
		<?php } else {?>
		<a href="<?php echo apf_first_last_uri($count_page);?>">最后一页</a>
		<?php }?>
	</div>
	<!-- 页面导航 -->

	<div class="article_thread"><div id="article_put">
		<p><strong>发表帖子</strong>
		<form action="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>&source=http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"  method="post">
			<?php if (apf_is_login()) { ?>
			<table>
				<tr><td>用户名：</td><td><?php echo $_SESSION['username'];?></td></tr>
				<tr><td>昵称：</td><td><?php echo $_SESSION['nickname'];?></td></tr>
			</table>
			<?php } else { ?>
			您还没有登录，<a href="<?php echo $apf_settings['base_url'];?>login.php?source=http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>">点此登录</a>
			<?php } ?>
			<p><textarea id="textarea_article_put" name="content_article"></textarea></p>
			<input type="hidden" value="<?php echo $article_thread['id'];?>" name="thread_id" />
			<div id="div_submit_article_put"><input id="submit_article_put" type="submit" value="提交" /></div>
		</form>
	</div></div>
</div>
<?php include_once('footer.php');?>
